﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Awesomium.Core;
using System.Threading;

namespace BrowserPL3
{
    class BrowserMainWindow
    {

        /// <summary>
        /// insialize the tab items list and tab content list
        /// <value>
        /// _tabItems value for tab items
        /// _tabContents; value for tab content
        /// </value>
        /// 
        /// </summary>
        /// 
        public List<TabItem> _tabItems;
        public List<TabStructure> _tabContents;
        private bool _WindowMaximized;
        /// <summary>
        /// BrowserMainWindow Constractor
        /// and it insialize the values
        /// </summary>
        public BrowserMainWindow()
        {
            _tabItems = new List<TabItem>();
            _tabContents = new List<TabStructure>();
            _WindowMaximized = true;
        }
        /// <summary>
        //property to set and get windowMaximized member
        /// </summary>
        public bool WindowMaximized
        {
            get { return _WindowMaximized; }
            set { _WindowMaximized = value; }
        }
        /// <summary>
        ///  //This function to Add new tab
        /// <remarks>
        /// by creating the tab and give the name and the content to it</remarks>
        /// </summary>
        /// <returns>return the tab to bye inserted in tab control</returns>
        public TabItem AddTabItem()
        {
            int count = _tabItems.Count;

            // create new tab item
            TabItem tab = new TabItem();

            
            tab.Name = string.Format("tab{0}", count);
            tab.Header = "Smart";

            // add controls to tab item, this case I added just a textbox
            TabStructure TabContent = new TabStructure();

            tab.Content = TabContent.TabStructur;
            _tabContents.Add(TabContent);
            TabContent.Close();

            _tabItems.Insert(count, tab);
            return tab;
        }

        /// <summary>
        ///    //This function remove the selected tab
        /// </summary>
        public void removeTab(TabItem selectedTab)
        {
            _tabItems.Remove(selectedTab);
        }

        /// <summary>
        /// ///This function retun the number of Tabs in theis window
        /// </summary>
        /// <returns>the number of the tabs</returns>
        public int tabsNumber() 
        {
            return _tabItems.Count();
        }


        /// <summary>
        /// /   //This function check if the window is maximized or not
        /// </summary>
        /// <returns>true or false (true maximized) (false minimized)</returns>
        public bool checkMaximized()
        {
            if (_WindowMaximized == true) return true;

            else return false;
        }

    }
}
